<script setup>
import { useRouter } from "vue-router"
const router = useRouter()
const jupmruoter = () => {
  router.push("/")
}
</script>
<template>
  <div class="cate">
    <!-- 头部 -->
    <div class="cate-heaer">
      <i class="i-arrow" @click="jupmruoter"></i>
      <h3>彪子有料</h3>
    </div>
    <!-- 输入框 -->
    <div class="cate-input">
      <div class="input-container">
        <input type="text" placeholder="炒锅牛肉">
        <i class="cate-search"></i>
        <i class="cate-del"></i>
      </div>
    </div>
    <!-- 热门推荐 -->
    <div class="cate-popular">
      <h2>家常菜的做法大全</h2>
      <ul>

        <li v-for="item in 5">
          <router-link to="">
            <div class="cate-popular-box">
              <div class="cate-list-left">
                <img src="../assets/image/2.2-list.jpeg" alt="">
              </div>
              <div class="cate-right">
                <p>蒜薹炒肉片</p>
                <p class="cate-txt">
                  <span>猪肉</span>
                </p>
                <span class="cate-span1">叶子美味</span>
                <div class="cate-icon">
                  <div class="cate-icon-left">
                    <i class=" icon-1 cate-icon-yanj"></i>
                    <span>692</span>
                  </div>
                  <div class="cate-icon-right">
                    <i class=" icon-1 cate-icon-xingx"></i>
                    <span>22</span>
                  </div>
                </div>
              </div>
            </div>
          </router-link>
        </li>

      </ul>
    </div>
  </div>
</template>
<style lang="less">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.cate {
  width: 100vw;
  margin: 0 auto;
  overflow: hidden;

  .cate-heaer {
    width: 100%;
    position: fixed;
    height: 60px;
    line-height: 60px;
    background-color: #FFA940;
    align-items: center;
    display: flex;
    padding: 0 15px;
    z-index: 1000;

    .i-arrow {
      display: inline-block;
      width: 24px;
      height: 32px;
      background-image: url("../assets/image/arrow.png");
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      margin-right: 10px;
    }

    h3 {
      font-size: 30px;
      font-family: aaa;
    }
  }

  .cate-input {
    margin-top: 60px;
    padding: 20px 20px;

    .input-container {
      position: relative;

      input {
        width: 100%;
        height: 40px;
        font-family: aaa;
        font-size: 16px;
        border-radius: 5px;
        border: 1px solid #ccc;
        padding-left: 30px;
        padding-right: 30px;
        font-size: 18px;
        font-weight: bold;
      }

      .cate-search {
        position: absolute;
        left: 10px;
        /* 距离左侧 10px */
        top: 50%;
        transform: translateY(-50%);
        display: inline-block;
        width: 20px;
        height: 20px;
        background-image: url("../assets/image/search.png");
        /* 替换为实际搜索图标路径 */
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        fill: #999999;
      }

      .cate-del {
        position: absolute;
        right: 10px;
        /* 距离右侧 10px */
        top: 50%;
        transform: translateY(-50%);
        display: inline-block;
        width: 16px;
        height: 16px;
        background-image: url("../assets/image/dle.png");
        /* 替换为实际删除图标路径 */
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        fill: #999999;
      }
    }
  }

  .cate-popular {
    padding: 0 20px;

    h2 {
      font-family: aaa;
      font-size: 20px;
      color: #302e2e;
      font-weight: bold;
      margin-bottom: 20px;
    }

    ul {
      list-style: none;

      li {
        display: flex;
        align-items: center;
        // 盒子居中
        // justify-content: center;
        margin-bottom: 10px;
        border-bottom: 2px solid #ccc;

        .cate-popular-box {
          display: flex;
          align-items: center;
          // 盒子居中
          justify-content: center;
          margin-bottom: 20px;
        }

        .cate-list-left {
          width: 150px;
          height: 100px;
          flex-shrink: 0;
          margin-right: 10px;

          img {
            width: 100%;
            height: 100%;
            border-radius: 5px;
            object-fit: cover;
          }
        }

        .cate-right {
          font-family: aaa;

          p {
            font-size: 20px;
            color: #302e2e;
            font-weight: bold;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            margin-bottom: 5px;
          }

          .cate-txt span {
            font-size: 16px;
            color: #6E6F8B;
          }

          .cate-span1 {
            font-size: 16px;
            color: #6E6F8B;
            margin-bottom: 5px;
          }

          .cate-icon {
            margin-top: 5px;
            display: flex;
            align-items: center;
            width: 100%;

            .cate-icon-left {
              display: flex;
              align-items: center;
              margin-right: 20px;

            }

            .cate-icon-right {
              display: flex;
              align-items: center;
              // margin-right: 20px;
            }

            .icon-1 {
              width: 30px;
              height: 30px;
              display: inline-block;
              background-size: cover;
              background-position: center;
              background-repeat: no-repeat;
              border-radius: 50%;
              margin-right: 5px;
            }

            .cate-icon-yanj {
              background-image: url("../assets/image/list-yanj.png");
            }

            .cate-icon-xingx {
              background-image: url("../assets/image/list-xingx.png");
            }
          }
        }
      }
    }
  }

}
</style>
